<template>
  <div class="top">
    <input type="text" placeholder="搜索">
    <div class="tasklist" v-for="(item,index) in tasklist" :key="index">
      <div :class="{active:suoyin == index }" @click="handleclick(index)">{{item}}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return{
        tasklist:['点餐','评价','商家'],
        suoyin:0
    }
  },
  methods: {
    handleclick(index){
        this.suoyin = index
    }
  }
};
</script>

<style scoped>
.top {
  padding-top: 30px;
  display: flex;
}
.top input {
  width: 50px;
  font-weight: 700;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding-left: 30px;
  margin-left: 10px;
  font-size: 16px;
}
.top .tasklist{
    display: flex;
}
.top .tasklist div{
  margin-left: 15px;
  font-weight: 700;
}
.top .tasklist .active{
    color: rgb(62, 144, 221);
    border-bottom: 3px solid  rgb(62, 144, 221);
}
</style>